Skip to content

feat!: make isContractInitialized a tri-state enum#21754

Merged
nchamo merged 5 commits intomerge-train/fairiesfrom
feat/contract-init-status-enum
Mar 19, 2026
Merged

feat!: make isContractInitialized a tri-state enum#21754
nchamo merged 5 commits intomerge-train/fairiesfrom
feat/contract-init-status-enum

Conversation

@nchamo
Copy link
Contributor

@nchamo nchamo commented Mar 18, 2026

Problem

After #21427, getContractMetadata.isContractInitialized returned boolean | undefined. The undefined case (no instance registered in PXE) was ambiguous -- consumers couldn't distinguish between "not initialized" and "can't determine status".

Fix

Replace boolean | undefined with a ContractInitializationStatus enum (YES, NO, UNKNOWN):

  • Instance registered: compute the private initialization nullifier (includes init_hash) for a definitive YES/NO
  • Instance not registered: fall back to checking the public initialization nullifier (address only). If found: YES. If absent: UNKNOWN (contract may have been privately initialized)

Fixes F-467

@nchamo nchamo self-assigned this Mar 18, 2026
@nchamo nchamo changed the title feat!(aztec.js): make isContractInitialized a tri-state enum feat!: make isContractInitialized a tri-state enum Mar 18, 2026
@nchamo nchamo requested a review from Thunkar March 18, 2026 18:33
Copy link
Contributor

@Thunkar Thunkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!

I'd rather have ContractInitializationStatus.INITIALIZED/UNINITIALIZED/UNKNOWN. Won't block, but wdyt?

nchamo added 2 commits March 19, 2026 11:02
…ontract-init-status-enum

# Conflicts:
#	docs/docs-developers/docs/resources/migration_notes.md
@nchamo nchamo requested a review from a team as a code owner March 19, 2026 14:05
@nchamo nchamo enabled auto-merge (squash) March 19, 2026 14:08
@nchamo nchamo merged commit 6b1e6d1 into merge-train/fairies Mar 19, 2026
19 of 23 checks passed
@nchamo nchamo deleted the feat/contract-init-status-enum branch March 19, 2026 14:27
@AztecBot
Copy link
Collaborator

❌ Failed to cherry-pick to v4-next due to conflicts. (🤖) View backport run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants